import Vue from "vue"
import VueRouter from "vue-router"

// 1.安装插件
Vue.use(VueRouter)

// 2.创建路由对象
const router = new VueRouter({
    routes: [
        {
            path: '',
            redirect: '/home'
        },
        {
            path: '/home',
            component: () => import('../views/home/Home')
        },
        {
            path: '/category',
            component: () => import('../views/category/Category')
        },
        {
            path: '/profile',
            component: () => import('../views/profile/Profile')
        },
        {
            path: '/cart',
            component: () => import('../views/cart/Cart')
        }
    ],
    mode: "history"
})

// 3.导出路由对象
export default router